import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * @Title: 数的范围
 * @Author 贾金博
 * @Package PACKAGE_NAME
 * @Date 2024/3/3 19:36
 * @description: 二分
 */
public class 数的范围 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] a = new int[n + 10];
        for (int i = 1; i <= n; i++) {
            a[i] = sc.nextInt();
        }

        List<Integer>lis = new ArrayList<>();
        for(int i : a) {
            lis.add(i);
        }
        while(k -- != 0) {
            int x = sc.nextInt();
            if(!lis.contains(x)) {
                System.out.println("-1 -1");
            } else { // 这个时候 是存在的情况
                int ret1 = 0, ret2 = 0;
                int l = 0, r = n + 1;
                while(l + 1 < r) {
                    int mid = (l + r) >> 1;
                    if(a[mid] < x)l = mid;
                    else r = mid;
                }
                ret1 = l + 1;
                // 重置
                l = 0;
                r = n + 1;
                while(l + 1 < r) {
                    int mid = (l + r) >> 1;
                    if(a[mid] <= x)l = mid;
                    else r = mid;
                }
                ret2 = l;
                ret1 --; // 下标是从0开始的
                ret2 --;
                System.out.println(ret1 + " " + ret2);
            }
        }
    }
}
